package com.juyu.miliao.api.controller;

import com.juyu.miliao.api.domain.dto.GameNoobMissionDTO;
import com.juyu.miliao.api.service.GameNoobMissionService;
import com.juyu.miliao.common.domain.Subject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author jh
 * @date 2019/09/16
 */
@RestController
@RequestMapping("/game/noob/free/mission")
@Api(tags = "游戏大厅,新手任务")
public class GameNoobMissionController {

    @Resource
    private GameNoobMissionService cuGameNoobMissionService;

    @GetMapping()
    @ApiOperation(value = "get", notes = "获取任务状态")
    public GameNoobMissionDTO getStatus(Authentication token) {
        Subject subject = (Subject) token.getPrincipal();
        Long userId = subject.getId();
        return cuGameNoobMissionService.getStatus(userId);
    }


    @PutMapping
    @ApiOperation(value = "update", notes = "领取奖励")
    public void update(Authentication token,
                       @RequestParam @ApiParam(value = "1-三国阵营 2-三国武将 3-击杀僵尸1只 4-击杀僵尸5只 5-vip奖励", required = true)
                               Integer type) {
        Subject subject = (Subject) token.getPrincipal();
        Long userId = subject.getId();
        cuGameNoobMissionService.getAward(userId, type);
    }


}
